<template>
  <page-wrap hide-tab back title="评定结果" stayStill bgColor="transparent">
    <view class="all-container" :style="{ height: screenHeight + 'px', width: screenWidth + 'px' }">
      <image class="iv-top-img"></image>

      <text class="judge-big-tip">评定失败</text>
      <text class="center-tip">您的简历评定失败，请确认您上传的简历格式及内容样式，并重新进行上传</text>

      <text class="refresh-btn" @click="handleReJudge" v-if="!isConsultant">重新评定</text>
      <view class="bottom-phone-tip">客服热线：<span class="phone">400-884-1001</span> （8:00-18:00）</view>
    </view>
  </page-wrap>
</template>

<script>
import { updateResumeDiagnoseReadStat } from "@/api/index";
export default {
  props: {
    recordId: {
      type: String,
      default: "",
    },
    fromZhituCard: {
      type: Boolean,
      default: false,
    },
  },
  watch: {
    recordId: {
      handler(val) {},
      deep: true, // 深度监听
      immediate: false, // 初始化的时候立刻执行一次
    },
  },
  computed: {
    isConsultant() {
      return getApp().globalData.loginStatus == "consultant";
    },
  },
  data() {
    return {
      screenHeight: 0,
      screenWidth: 0,
      personId: uni.getStorageSync("person-id").slice(2) || undefined,
    };
  },
  onReady() {
    let systemInfo = uni.getSystemInfoSync();
    this.screenHeight = systemInfo.windowHeight;
    this.screenWidth = systemInfo.windowWidth;
  },
  methods: {
    handleReJudge() {
      // 重新评定
      uni.showLoading();
      let param = {
        personId: this.personId,
        diagnoseRecordId: this.recordId,
      };

      updateResumeDiagnoseReadStat(param).then((res) => {
        uni.hideLoading();
        if (res.code == 200) {
          let url = "/pagesSub/career/activity/AttachmentUpload";
          if (this.fromZhituCard) {
            url =
              "/pagesSub/career/activity/AttachmentUpload?fromWhere=careerPath";
          }
          uni.redirectTo({
            url,
          });
        } else {
          uni.showToast({
            title: res.status_desc,
            icon: "none",
            duration: 2000
          });
        }
      });
    },
  },
};
</script>
<style  lang="scss" scoped>
.all-container {
  display: flex;
  flex-direction: column;
  align-items: center;

  width: 100%;
  height: 100%;

  .iv-top-img {
    width: 200rpx;
    height: 200rpx;
    margin-top: 50rpx;
    background-size: 100% 100%;
    background-image: url($img-base + "company/cert_audit.png");
  }

  .judge-big-tip {
    font-size: 50rpx;
    margin-top: 50rpx;
  }
  .center-tip {
    width: 80%;
    text-align: center;
    margin-top: 50rpx;
  }
  .refresh-btn {
    width: 80%;
    text-align: center;
    margin-top: 50rpx;
    padding-top: 20rpx;
    padding-bottom: 20rpx;
    border-radius: 5px;
    background-color: red;
    color: white;
  }

  .bottom-phone-tip {
    width: auto;
    position: fixed;
    bottom: 15rpx;
  }

  .phone {
    width: auto;
    color: red;
  }
}
</style>